Optimal. Leaf size=190 \[ \frac {\left (a^4 c-6 a^2 b^2 c+b^4 c+4 a^3 b d-4 a b^3 d\right ) x}{c^2+d^2}-\frac {\left (4 a^3 b c-4 a b^3 c-a^4 d+6 a^2 b^2 d-b^4 d\right ) \log (\cos (e+f x))}{\left (c^2+d^2\right ) f}+\frac {(b c-a d)^4 \log (c+d \tan (e+f x))}{d^3 \left (c^2+d^2\right ) f}-\frac {b^3 (b c-3 a d) \tan (e+f x)}{d^2 f}+\frac {b^2 (a+b \tan (e+f x))^2}{2 d f} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.33, antiderivative size = 190, normalized size of antiderivative = 1.00, number of steps
used = 6, number of rules used = 6, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.240, Rules used = {3647, 3718,
3707, 3698, 31, 3556} \begin {gather*} -\frac {\left (a^4 (-d)+4 a^3 b c+6 a^2 b^2 d-4 a b^3 c-b^4 d\right ) \log (\cos (e+f x))}{f \left (c^2+d^2\right )}+\frac {x \left (a^4 c+4 a^3 b d-6 a^2 b^2 c-4 a b^3 d+b^4 c\right )}{c^2+d^2}-\frac {b^3 (b c-3 a d) \tan (e+f x)}{d^2 f}+\frac {b^2 (a+b \tan (e+f x))^2}{2 d f}+\frac {(b c-a d)^4 \log (c+d \tan (e+f x))}{d^3 f \left (c^2+d^2\right )} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 31
Rule 3556
Rule 3647
Rule 3698
Rule 3707
Rule 3718
Rubi steps
\begin {align*} \int \frac {(a+b \tan (e+f x))^4}{c+d \tan (e+f x)} \, dx &=\frac {b^2 (a+b \tan (e+f x))^2}{2 d f}+\frac {\int \frac {(a+b \tan (e+f x)) \left (-2 \left (b^3 c-a^3 d\right )+2 b \left (3 a^2-b^2\right ) d \tan (e+f x)-2 b^2 (b c-3 a d) \tan ^2(e+f x)\right )}{c+d \tan (e+f x)} \, dx}{2 d}\\ &=-\frac {b^3 (b c-3 a d) \tan (e+f x)}{d^2 f}+\frac {b^2 (a+b \tan (e+f x))^2}{2 d f}-\frac {\int \frac {-2 \left (b^4 c^2-4 a b^3 c d+a^4 d^2\right )-8 a b \left (a^2-b^2\right ) d^2 \tan (e+f x)+2 b^2 \left (4 a b c d-6 a^2 d^2-b^2 \left (c^2-d^2\right )\right ) \tan ^2(e+f x)}{c+d \tan (e+f x)} \, dx}{2 d^2}\\ &=\frac {\left (a^4 c-6 a^2 b^2 c+b^4 c+4 a^3 b d-4 a b^3 d\right ) x}{c^2+d^2}-\frac {b^3 (b c-3 a d) \tan (e+f x)}{d^2 f}+\frac {b^2 (a+b \tan (e+f x))^2}{2 d f}+\frac {(b c-a d)^4 \int \frac {1+\tan ^2(e+f x)}{c+d \tan (e+f x)} \, dx}{d^2 \left (c^2+d^2\right )}+\frac {\left (4 a^3 b c-4 a b^3 c-a^4 d+6 a^2 b^2 d-b^4 d\right ) \int \tan (e+f x) \, dx}{c^2+d^2}\\ &=\frac {\left (a^4 c-6 a^2 b^2 c+b^4 c+4 a^3 b d-4 a b^3 d\right ) x}{c^2+d^2}-\frac {\left (4 a^3 b c-4 a b^3 c-a^4 d+6 a^2 b^2 d-b^4 d\right ) \log (\cos (e+f x))}{\left (c^2+d^2\right ) f}-\frac {b^3 (b c-3 a d) \tan (e+f x)}{d^2 f}+\frac {b^2 (a+b \tan (e+f x))^2}{2 d f}+\frac {(b c-a d)^4 \text {Subst}\left (\int \frac {1}{c+x} \, dx,x,d \tan (e+f x)\right )}{d^3 \left (c^2+d^2\right ) f}\\ &=\frac {\left (a^4 c-6 a^2 b^2 c+b^4 c+4 a^3 b d-4 a b^3 d\right ) x}{c^2+d^2}-\frac {\left (4 a^3 b c-4 a b^3 c-a^4 d+6 a^2 b^2 d-b^4 d\right ) \log (\cos (e+f x))}{\left (c^2+d^2\right ) f}+\frac {(b c-a d)^4 \log (c+d \tan (e+f x))}{d^3 \left (c^2+d^2\right ) f}-\frac {b^3 (b c-3 a d) \tan (e+f x)}{d^2 f}+\frac {b^2 (a+b \tan (e+f x))^2}{2 d f}\\ \end {align*}
________________________________________________________________________________________
Mathematica [C] Result contains complex when optimal does not.
time = 1.30, size = 160, normalized size = 0.84 \begin {gather*} \frac {\frac {\frac {(a+i b)^4 d^2 \log (i-\tan (e+f x))}{i c-d}-\frac {(a-i b)^4 d^2 \log (i+\tan (e+f x))}{i c+d}+\frac {2 (b c-a d)^4 \log (c+d \tan (e+f x))}{d \left (c^2+d^2\right )}}{d}-\frac {2 b^3 (b c-3 a d) \tan (e+f x)}{d}+b^2 (a+b \tan (e+f x))^2}{2 d f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.23, size = 221, normalized size = 1.16
method | result | size |
derivativedivides | \(\frac {\frac {b^{3} \left (\frac {b d \left (\tan ^{2}\left (f x +e \right )\right )}{2}+4 a d \tan \left (f x +e \right )-b c \tan \left (f x +e \right )\right )}{d^{2}}+\frac {\frac {\left (-a^{4} d +4 a^{3} b c +6 a^{2} b^{2} d -4 a \,b^{3} c -b^{4} d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{4} c +4 a^{3} b d -6 a^{2} b^{2} c -4 b^{3} d a +b^{4} c \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}+\frac {\left (a^{4} d^{4}-4 a^{3} b c \,d^{3}+6 a^{2} b^{2} c^{2} d^{2}-4 a \,b^{3} c^{3} d +b^{4} c^{4}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{3} \left (c^{2}+d^{2}\right )}}{f}\) | \(221\) |
default | \(\frac {\frac {b^{3} \left (\frac {b d \left (\tan ^{2}\left (f x +e \right )\right )}{2}+4 a d \tan \left (f x +e \right )-b c \tan \left (f x +e \right )\right )}{d^{2}}+\frac {\frac {\left (-a^{4} d +4 a^{3} b c +6 a^{2} b^{2} d -4 a \,b^{3} c -b^{4} d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2}+\left (a^{4} c +4 a^{3} b d -6 a^{2} b^{2} c -4 b^{3} d a +b^{4} c \right ) \arctan \left (\tan \left (f x +e \right )\right )}{c^{2}+d^{2}}+\frac {\left (a^{4} d^{4}-4 a^{3} b c \,d^{3}+6 a^{2} b^{2} c^{2} d^{2}-4 a \,b^{3} c^{3} d +b^{4} c^{4}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{d^{3} \left (c^{2}+d^{2}\right )}}{f}\) | \(221\) |
norman | \(\frac {\left (a^{4} c +4 a^{3} b d -6 a^{2} b^{2} c -4 b^{3} d a +b^{4} c \right ) x}{c^{2}+d^{2}}+\frac {b^{3} \left (4 a d -b c \right ) \tan \left (f x +e \right )}{d^{2} f}+\frac {b^{4} \left (\tan ^{2}\left (f x +e \right )\right )}{2 d f}+\frac {\left (a^{4} d^{4}-4 a^{3} b c \,d^{3}+6 a^{2} b^{2} c^{2} d^{2}-4 a \,b^{3} c^{3} d +b^{4} c^{4}\right ) \ln \left (c +d \tan \left (f x +e \right )\right )}{\left (c^{2}+d^{2}\right ) d^{3} f}-\frac {\left (a^{4} d -4 a^{3} b c -6 a^{2} b^{2} d +4 a \,b^{3} c +b^{4} d \right ) \ln \left (1+\tan ^{2}\left (f x +e \right )\right )}{2 f \left (c^{2}+d^{2}\right )}\) | \(226\) |
risch | \(-\frac {12 i a^{2} b^{2} c^{2} e}{\left (c^{2}+d^{2}\right ) d f}+\frac {8 i a \,b^{3} c^{3} e}{\left (c^{2}+d^{2}\right ) d^{2} f}-\frac {4 i x \,b^{3} a}{i d -c}+\frac {12 i b^{2} a^{2} x}{d}+\frac {2 i b^{4} c^{2} x}{d^{3}}-\frac {2 i b^{4} e}{d f}-\frac {2 i d \,a^{4} x}{c^{2}+d^{2}}+\frac {d \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) a^{4}}{\left (c^{2}+d^{2}\right ) f}+\frac {4 i x \,a^{3} b}{i d -c}-\frac {6 b^{2} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a^{2}}{d f}-\frac {b^{4} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) c^{2}}{d^{3} f}+\frac {6 x \,a^{2} b^{2}}{i d -c}-\frac {2 i b^{4} x}{d}+\frac {b^{4} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )}{d f}+\frac {4 b^{3} \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right ) a c}{d^{2} f}-\frac {4 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) a^{3} b c}{\left (c^{2}+d^{2}\right ) f}+\frac {\ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) b^{4} c^{4}}{\left (c^{2}+d^{2}\right ) d^{3} f}+\frac {2 i b^{3} \left (4 a d \,{\mathrm e}^{2 i \left (f x +e \right )}-b c \,{\mathrm e}^{2 i \left (f x +e \right )}-i b d \,{\mathrm e}^{2 i \left (f x +e \right )}+4 a d -b c \right )}{d^{2} f \left ({\mathrm e}^{2 i \left (f x +e \right )}+1\right )^{2}}+\frac {12 i b^{2} a^{2} e}{d f}-\frac {8 i b^{3} a c x}{d^{2}}+\frac {2 i b^{4} c^{2} e}{d^{3} f}-\frac {2 i d \,a^{4} e}{\left (c^{2}+d^{2}\right ) f}+\frac {8 i a^{3} b c x}{c^{2}+d^{2}}-\frac {2 i b^{4} c^{4} x}{\left (c^{2}+d^{2}\right ) d^{3}}-\frac {8 i b^{3} a c e}{d^{2} f}+\frac {8 i a^{3} b c e}{\left (c^{2}+d^{2}\right ) f}-\frac {12 i a^{2} b^{2} c^{2} x}{\left (c^{2}+d^{2}\right ) d}+\frac {8 i a \,b^{3} c^{3} x}{\left (c^{2}+d^{2}\right ) d^{2}}-\frac {2 i b^{4} c^{4} e}{\left (c^{2}+d^{2}\right ) d^{3} f}+\frac {6 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) a^{2} b^{2} c^{2}}{\left (c^{2}+d^{2}\right ) d f}-\frac {4 \ln \left ({\mathrm e}^{2 i \left (f x +e \right )}-\frac {i d +c}{i d -c}\right ) a \,b^{3} c^{3}}{\left (c^{2}+d^{2}\right ) d^{2} f}-\frac {x \,b^{4}}{i d -c}-\frac {x \,a^{4}}{i d -c}\) | \(848\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.64, size = 229, normalized size = 1.21 \begin {gather*} \frac {\frac {2 \, {\left ({\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} c + 4 \, {\left (a^{3} b - a b^{3}\right )} d\right )} {\left (f x + e\right )}}{c^{2} + d^{2}} + \frac {2 \, {\left (b^{4} c^{4} - 4 \, a b^{3} c^{3} d + 6 \, a^{2} b^{2} c^{2} d^{2} - 4 \, a^{3} b c d^{3} + a^{4} d^{4}\right )} \log \left (d \tan \left (f x + e\right ) + c\right )}{c^{2} d^{3} + d^{5}} + \frac {{\left (4 \, {\left (a^{3} b - a b^{3}\right )} c - {\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{2} + d^{2}} + \frac {b^{4} d \tan \left (f x + e\right )^{2} - 2 \, {\left (b^{4} c - 4 \, a b^{3} d\right )} \tan \left (f x + e\right )}{d^{2}}}{2 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 1.61, size = 305, normalized size = 1.61 \begin {gather*} \frac {2 \, {\left ({\left (a^{4} - 6 \, a^{2} b^{2} + b^{4}\right )} c d^{3} + 4 \, {\left (a^{3} b - a b^{3}\right )} d^{4}\right )} f x + {\left (b^{4} c^{2} d^{2} + b^{4} d^{4}\right )} \tan \left (f x + e\right )^{2} + {\left (b^{4} c^{4} - 4 \, a b^{3} c^{3} d + 6 \, a^{2} b^{2} c^{2} d^{2} - 4 \, a^{3} b c d^{3} + a^{4} d^{4}\right )} \log \left (\frac {d^{2} \tan \left (f x + e\right )^{2} + 2 \, c d \tan \left (f x + e\right ) + c^{2}}{\tan \left (f x + e\right )^{2} + 1}\right ) - {\left (b^{4} c^{4} - 4 \, a b^{3} c^{3} d + 6 \, a^{2} b^{2} c^{2} d^{2} - 4 \, a b^{3} c d^{3} + {\left (6 \, a^{2} b^{2} - b^{4}\right )} d^{4}\right )} \log \left (\frac {1}{\tan \left (f x + e\right )^{2} + 1}\right ) - 2 \, {\left (b^{4} c^{3} d - 4 \, a b^{3} c^{2} d^{2} + b^{4} c d^{3} - 4 \, a b^{3} d^{4}\right )} \tan \left (f x + e\right )}{2 \, {\left (c^{2} d^{3} + d^{5}\right )} f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [C] Result contains complex when optimal does not.
time = 1.37, size = 2516, normalized size = 13.24 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.99, size = 238, normalized size = 1.25 \begin {gather*} \frac {\frac {2 \, {\left (a^{4} c - 6 \, a^{2} b^{2} c + b^{4} c + 4 \, a^{3} b d - 4 \, a b^{3} d\right )} {\left (f x + e\right )}}{c^{2} + d^{2}} + \frac {{\left (4 \, a^{3} b c - 4 \, a b^{3} c - a^{4} d + 6 \, a^{2} b^{2} d - b^{4} d\right )} \log \left (\tan \left (f x + e\right )^{2} + 1\right )}{c^{2} + d^{2}} + \frac {2 \, {\left (b^{4} c^{4} - 4 \, a b^{3} c^{3} d + 6 \, a^{2} b^{2} c^{2} d^{2} - 4 \, a^{3} b c d^{3} + a^{4} d^{4}\right )} \log \left ({\left | d \tan \left (f x + e\right ) + c \right |}\right )}{c^{2} d^{3} + d^{5}} + \frac {b^{4} d \tan \left (f x + e\right )^{2} - 2 \, b^{4} c \tan \left (f x + e\right ) + 8 \, a b^{3} d \tan \left (f x + e\right )}{d^{2}}}{2 \, f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 5.78, size = 235, normalized size = 1.24 \begin {gather*} \frac {\mathrm {tan}\left (e+f\,x\right )\,\left (\frac {4\,a\,b^3}{d}-\frac {b^4\,c}{d^2}\right )}{f}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )+1{}\mathrm {i}\right )\,\left (a^4-a^3\,b\,4{}\mathrm {i}-6\,a^2\,b^2+a\,b^3\,4{}\mathrm {i}+b^4\right )}{2\,f\,\left (d+c\,1{}\mathrm {i}\right )}+\frac {b^4\,{\mathrm {tan}\left (e+f\,x\right )}^2}{2\,d\,f}-\frac {\ln \left (\mathrm {tan}\left (e+f\,x\right )-\mathrm {i}\right )\,\left (a^4\,1{}\mathrm {i}-4\,a^3\,b-a^2\,b^2\,6{}\mathrm {i}+4\,a\,b^3+b^4\,1{}\mathrm {i}\right )}{2\,f\,\left (c+d\,1{}\mathrm {i}\right )}+\frac {\ln \left (c+d\,\mathrm {tan}\left (e+f\,x\right )\right )\,\left (a^4\,d^4-4\,a^3\,b\,c\,d^3+6\,a^2\,b^2\,c^2\,d^2-4\,a\,b^3\,c^3\,d+b^4\,c^4\right )}{f\,\left (c^2\,d^3+d^5\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________